package com.sure.supermarketserver.stock.maintenance.impl;

import com.sure.supermarketserver.common.Utils;
import com.sure.supermarketserver.stock.maintenance.Maintenance;
import com.sure.supermarketserver.stock.maintenance.MaintenanceService;
import com.sure.supermarketserver.stock.maintenance.dao.MaintenanceDao;
import com.sure.supermarketserver.stock.maintenance.MaintenanceDto;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Map;

@Service
@Transactional
public class MaintenanceServiceImpl implements MaintenanceService {

    @Resource
    private MaintenanceDao maintenanceDao;

    @Override
    public Map<String, Object> findMaintenanceList(MaintenanceDto dto) {
        return Utils.getPage(dto,()->maintenanceDao.findMaintenanceList(dto));
    }
    

    @Override
    public void addMaintenance(MaintenanceDto dto) {
        maintenanceDao.insertMaintenance(dto);
    }

    @Override
    public void delMaintenance(String id) {
        maintenanceDao.deleteMaintenance(id);
    }

    @Override
    public void updMaintenance(MaintenanceDto dto) {
        maintenanceDao.updateMaintenance(dto);
    }
}
